#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>
#include <QTreeWidgetItem>
#include <QList>
#include "input.h"

namespace Ui {
class MainWindow;
}

typedef struct {
    int type;
    int id;
    int line;
    QString title;
    QTreeWidgetItem *item;
} T;

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private slots:
    void on_close_clicked();

    void on_select_clicked();

    void on_outline_tree_widget_itemClicked(QTreeWidgetItem *item, int column);

private:
    Ui::MainWindow *ui;
    QSqlDatabase db;
    QList<T> Tree;
    int current_type;
    int current_id;
    Input *input;
    void get_children_record(T t, QTreeWidgetItem *item, QString article_id, QString parent_id);
};

#endif // MAINWINDOW_H
